﻿using UnityEngine;
using System.Collections;

public class Mover : MonoBehaviour {

    Transform[] rb;
    public float speed = 2;

    public float coolDown;						
    public float dist;						
    private float tmpMoveTime;				
    
    // Use this for initialization
	void Start () {
        rb = gameObject.GetComponentsInChildren<Transform>();
	}
	
	// Update is called once per frame
	void FixedUpdate () {


        if (tmpMoveTime >= coolDown)
        {
            tmpMoveTime = 0;
            foreach (var item in rb)
            {
                item.transform.position = new Vector2(item.transform.position.x, (item.transform.position.y + dist));
            }
        }
        else
        {
            //Add 1 to tmpFireTime
            tmpMoveTime += 1 * Time.deltaTime;
        }

	}
}
